
<div style="width:300px;margin:0 auto">
  <h3>emp_update.html</h3>
  <form id="emp_update_form" method="post">
  <table class="emp_table" id="xxx">

    <tr >
      <td>员工编号</td>
      <td><input type="text" name="empno" class="easyui-textbox" value="{{emp.empno}}" readonly/></td>
    </tr>

    <tr>
      <td>员工姓名</td>
      <td><input type="text" name="ename" class="easyui-textbox" required data-options="missingMessage:'必须的'" value="{{emp.ename}}"/></td>
    </tr>
    <tr>
      <td>工资</td>
      <td><input type="text" name="sal" class="easyui-textbox" value="{{emp.sal}}"/></td>
    </tr>
    <tr>
      <td>雇佣日期</td>
      <td><input type="text"  name="hiredate" class="easyui-datebox" value="{{emp.hiredate}}"/></td>
    </tr>
    <tr>
      <td>部门</td>
      <td>
        <select  name="deptno" id="deptno" class="easyui-combobox" style="width:170px" >
          {% for dept in dept_list %}
          {% if dept.deptno == emp.dept_id %}

          <option value="{{dept.deptno}}" selected="true">{{dept.dname}}</option>
          {% else %}

          <option value="{{dept.deptno}}">{{dept.dname}}</option>
          {% endif %}
          {% endfor %}
      </select>
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <input type="button" class="easyui-linkbutton" style="width:100px;height:30px" value="更新" id="emp_update_btn"/>
      </td>
    </tr>
  </table>
  </form>
</div>
<script type="text/javascript">


  $("#emp_update_btn").click(function(){

    $("#emp_update_form").form('submit',{
      url:'{% url 'easyui.emp_update'%}',
      onSubmit:function(){
        var isValid = $(this).form('validate')
        return isValid
      },
      success:function(data){
        data = eval('('+data+')')
        closeUpdateEmpWin()
      }
    })
  })
</script>

